<!doctype html>


<html>
<head>
  <link rel="shortcut icon" href="static/images/favicon.ico" type="image/x-icon">
  <title>QuadTree (Closure Library API Documentation - JavaScript)</title>
  <link rel="stylesheet" href="static/css/base.css">
  <link rel="stylesheet" href="static/css/doc.css">
  <link rel="stylesheet" href="static/css/sidetree.css">
  <link rel="stylesheet" href="static/css/prettify.css">

  <script>
     var _staticFilePath = "static/";
     var _typeTreeName = "goog";
     var _fileTreeName = "Source";
  </script>

  <script src="static/js/doc.js">
  </script>

  <script type="text/javascript" src="//www.google.com/jsapi"></script>
  <script type="text/javascript">
     google.load("visualization", "1", {packages:["orgchart"]});
     var _loadingVisualizations = true;
  </script>

  <meta charset="utf8">
</head>

<body onload="grokdoc.onLoad();">

<div id="header">
  <div class="g-section g-tpl-50-50 g-split">
    <div class="g-unit g-first">
      <a id="logo" href="index.html">Closure Library API Documentation</a>
    </div>

    <div class="g-unit">
      <div class="g-c">
        <strong>Go to class or file:</strong>
        <input type="text" id="ac">
      </div>
    </div>
  </div>
</div>





<div class="colmask rightmenu">
<div class="colleft">
    <div class="col1">
      <!-- Column 1 start -->

<div id="title">
        <span class="fn">structs.QuadTree</span>
        <span>Extends</span>
        <span class="fn-name">
          
        </span>
</div>

<div class="g-section g-tpl-75-25">
  <div class="g-unit g-first" id="description">
    Constructs a new quad tree.

  </div>


        <div class="g-unit" id="useful-links">
          <div class="title">Useful links</div>
          <ol>
            <li><a href="http://closure-library.googlecode.com/git/closure/goog/demos/quadtree.html">Demo</a></li>
            <li><a href="local_closure_goog_structs_quadtree.js.source.html"><span class='source-code-link'>Source Code</span></a></li>
            <li><a href="http://code.google.com/p/closure-library/source/browse/local/closure/goog/structs/quadtree.js">Git</a></li>
          </ol>
        </div>
</div>






<h2 class="g-first">Inheritance</h2>
<div class='gviz-org-chart-container goog-inline-block'>
<table class='gviz-org-chart' style='display:none'>
  <tr><td>goog.structs.QuadTree</td><td></td></tr>
</table>
</div>
<div class='gviz-org-chart-container goog-inline-block'>
<table class='gviz-org-chart' style='display:none'>
</table>
</div>




  <h2>Constructor</h2>
      <div class="fn-constructor">
    goog.structs.QuadTree(<span><span class="arg">minX</span>,&nbsp;<span class="arg">minY</span>,&nbsp;<span class="arg">maxX</span>,&nbsp;<span class="arg">maxY</span></span>)
  </div>

   <h3>Parameters</h3>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">minX</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Number">number</a></span>
        <div class="entryOverview">Minimum x-value that can be held in tree.</div>
     </td>
   </tr>
     
   <tr class="odd">
     <td>
        <span class="entryName">minY</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Number">number</a></span>
        <div class="entryOverview">Minimum y-value that can be held in tree.</div>
     </td>
   </tr>
     
   <tr class="even">
     <td>
        <span class="entryName">maxX</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Number">number</a></span>
        <div class="entryOverview">Maximum x-value that can be held in tree.</div>
     </td>
   </tr>
     
   <tr class="odd">
     <td>
        <span class="entryName">maxY</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Number">number</a></span>
        <div class="entryOverview">Maximum y-value that can be held in tree.</div>
     </td>
   </tr>
  </table>


<h2>Instance Methods</h2>


  <div class="legend">
        <span class="key publickey"></span><span>Public</span>
        <span class="key protectedkey"></span><span>Protected</span>
        <span class="key privatekey"></span><span>Private</span>
  </div>







<div>
       <div class="desc">
         Defined in
         <span class="fn-name">
            <a href="class_goog_structs_QuadTree.html">
              goog.structs.QuadTree
            </a>
         </span>
       </div>






<div class="section">
  <table class="horiz-rule">


     <tr class="even entry private">
       <td class="access"></td>






  <td>
    <a name="goog.structs.QuadTree.prototype.balance_"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryName">balance_<span class="args">(<span class="arg">node</span>)</span>
        </span>
      </div>


     <div class="entryOverview">
       Attempts to balance a node. A node will need balancing if all its children
are empty or it contains just one leaf.

     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">node</span>
        : <span class="type"><a href="class_goog_structs_QuadTree_Node.html">goog.structs.QuadTree.Node</a></span>
        <div class="entryOverview">The node to balance.</div>
     </td>
   </tr>
  </table>
      </div>
   
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_structs_quadtree.js.source.html#line346">code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry public">
       <td class="access"></td>






  <td>
    <a name="goog.structs.QuadTree.prototype.clear"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryName">clear<span class="args">()</span>
        </span>
      </div>


     <div class="entryOverview">
       Removes all items from the tree.

     </div>

   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_structs_quadtree.js.source.html#line154">code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry public">
       <td class="access"></td>






  <td>
    <a name="goog.structs.QuadTree.prototype.clone"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryName">clone<span class="args">()</span>
        </span>
        &#8658; <span>!</span><span class="type"><a href="class_goog_structs_QuadTree.html">goog.structs.QuadTree</a></span>
      </div>


     <div class="entryOverview">
       Clones the quad-tree and returns the new instance.

     </div>


    <! -- Method details -->
    <div class="entryDetails">

   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<span>!</span><span class="type"><a href="class_goog_structs_QuadTree.html">goog.structs.QuadTree</a></span>&nbsp;
            A clone of the tree.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_structs_quadtree.js.source.html#line193">code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry public">
       <td class="access"></td>






  <td>
    <a name="goog.structs.QuadTree.prototype.contains"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryName">contains<span class="args">(<span class="arg">x</span>,&nbsp;<span class="arg">y</span>)</span>
        </span>
        &#8658; <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Boolean">boolean</a></span>
      </div>


     <div class="entryOverview">
       Returns true if the point at (x, y) exists in the tree.

     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">x</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Number">number</a></span>
        <div class="entryOverview">The x-coordinate.</div>
     </td>
   </tr>
     
   <tr class="odd">
     <td>
        <span class="entryName">y</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Number">number</a></span>
        <div class="entryOverview">The y-coordinate.</div>
     </td>
   </tr>
  </table>
      </div>
   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Boolean">boolean</a></span>&nbsp;
            Whether the tree contains a point at (x, y).
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_structs_quadtree.js.source.html#line130">code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry private">
       <td class="access"></td>






  <td>
    <a name="goog.structs.QuadTree.prototype.find_"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryName">find_<span class="args">(<span class="arg">node</span>,&nbsp;<span class="arg">x</span>,&nbsp;<span class="arg">y</span>)</span>
        </span>
        &#8658; <span class="type"><a href="class_goog_structs_QuadTree_Node.html">goog.structs.QuadTree.Node</a></span>
      </div>


     <div class="entryOverview">
       Finds a leaf node with the same (x, y) coordinates as the target point, or
null if no point exists.

     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">node</span>
        : <span class="type"><a href="class_goog_structs_QuadTree_Node.html">goog.structs.QuadTree.Node</a></span>
        <div class="entryOverview">The node to search in.</div>
     </td>
   </tr>
     
   <tr class="odd">
     <td>
        <span class="entryName">x</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Number">number</a></span>
        <div class="entryOverview">The x-coordinate of the point to search for.</div>
     </td>
   </tr>
     
   <tr class="even">
     <td>
        <span class="entryName">y</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Number">number</a></span>
        <div class="entryOverview">The y-coordinate of the point to search for.</div>
     </td>
   </tr>
  </table>
      </div>
   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<span class="type"><a href="class_goog_structs_QuadTree_Node.html">goog.structs.QuadTree.Node</a></span>&nbsp;
            The leaf node that matches the target,
    or null if it doesn't exist.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_structs_quadtree.js.source.html#line262">code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry public">
       <td class="access"></td>






  <td>
    <a name="goog.structs.QuadTree.prototype.forEach"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryName">forEach<span class="args">(<span class="arg">fn</span>,&nbsp;<span class="arg">opt_obj</span>)</span>
        </span>
      </div>


     <div class="entryOverview">
       Traverses the tree and calls a function on each node.

     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">fn</span>
        : <span class="type">function(?, goog.math.Coordinate, goog.structs.QuadTree</span>)
        <div class="entryOverview">The function to call for every value. This function takes 3 arguments
    (the value, the coordinate, and the tree itself) and the return value is
    irrelevant.</div>
     </td>
   </tr>
     
   <tr class="odd">
     <td>
        <span class="entryName">opt_obj</span>
        : <span class="type">Object=</span>
        <div class="entryOverview">The object to be used as the value of 'this'
    within code fn.</div>
     </td>
   </tr>
  </table>
      </div>
   
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_structs_quadtree.js.source.html#line218">code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry public">
       <td class="access"></td>






  <td>
    <a name="goog.structs.QuadTree.prototype.get"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryName">get<span class="args">(<span class="arg">x</span>,&nbsp;<span class="arg">y</span>,&nbsp;<span class="arg">opt_default</span>)</span>
        </span>
        &#8658; <span class="type">*</span>
      </div>


     <div class="entryOverview">
       Gets the value of the point at (x, y) or null if the point is empty.

     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">x</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Number">number</a></span>
        <div class="entryOverview">The x-coordinate.</div>
     </td>
   </tr>
     
   <tr class="odd">
     <td>
        <span class="entryName">y</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Number">number</a></span>
        <div class="entryOverview">The y-coordinate.</div>
     </td>
   </tr>
     
   <tr class="even">
     <td>
        <span class="entryName">opt_default</span>
        : <span class="type">*=</span>
        <div class="entryOverview">The default value to return if the node doesn't
    exist.</div>
     </td>
   </tr>
  </table>
      </div>
   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<span class="type">*</span>&nbsp;
            The value of the node, the default value if the node
    doesn't exist, or undefined if the node doesn't exist and no default
    has been provided.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_structs_quadtree.js.source.html#line96">code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry public">
       <td class="access"></td>






  <td>
    <a name="goog.structs.QuadTree.prototype.getCount"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryName">getCount<span class="args">()</span>
        </span>
        &#8658; <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Number">number</a></span>
      </div>


     <div class="entryOverview">
       <span class='nodesc'>No description.</span>
     </div>


    <! -- Method details -->
    <div class="entryDetails">

   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Number">number</a></span>&nbsp;
            The number of items in the tree.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_structs_quadtree.js.source.html#line146">code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry public">
       <td class="access"></td>






  <td>
    <a name="goog.structs.QuadTree.prototype.getKeys"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryName">getKeys<span class="args">()</span>
        </span>
        &#8658; <span>!</span><span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Array">Array</a></span>.&lt;<span>?</span><span class="type"><a href="class_goog_math_Coordinate.html">goog.math.Coordinate</a></span>&gt;
      </div>


     <div class="entryOverview">
       Returns an array containing the coordinates of each point stored in the tree.

     </div>


    <! -- Method details -->
    <div class="entryDetails">

   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<span>!</span><span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Array">Array</a></span>.&lt;<span>?</span><span class="type"><a href="class_goog_math_Coordinate.html">goog.math.Coordinate</a></span>&gt;&nbsp;
            Array of coordinates.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_structs_quadtree.js.source.html#line166">code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry private">
       <td class="access"></td>






  <td>
    <a name="goog.structs.QuadTree.prototype.getQuadrantForPoint_"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryName">getQuadrantForPoint_<span class="args">(<span class="arg">parent</span>,&nbsp;<span class="arg">x</span>,&nbsp;<span class="arg">y</span>)</span>
        </span>
        &#8658; <span class="type"><a href="class_goog_structs_QuadTree_Node.html">goog.structs.QuadTree.Node</a></span>
      </div>


     <div class="entryOverview">
       Returns the child quadrant within a node that contains the given (x, y)
coordinate.

     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">parent</span>
        : <span class="type"><a href="class_goog_structs_QuadTree_Node.html">goog.structs.QuadTree.Node</a></span>
        <div class="entryOverview">The node.</div>
     </td>
   </tr>
     
   <tr class="odd">
     <td>
        <span class="entryName">x</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Number">number</a></span>
        <div class="entryOverview">The x-coordinate to look for.</div>
     </td>
   </tr>
     
   <tr class="even">
     <td>
        <span class="entryName">y</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Number">number</a></span>
        <div class="entryOverview">The y-coordinate to look for.</div>
     </td>
   </tr>
  </table>
      </div>
   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<span class="type"><a href="class_goog_structs_QuadTree_Node.html">goog.structs.QuadTree.Node</a></span>&nbsp;
            The child quadrant that contains the
    point.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_structs_quadtree.js.source.html#line419">code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry public">
       <td class="access"></td>






  <td>
    <a name="goog.structs.QuadTree.prototype.getRootNode"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryName">getRootNode<span class="args">()</span>
        </span>
        &#8658; <span class="type"><a href="class_goog_structs_QuadTree_Node.html">goog.structs.QuadTree.Node</a></span>
      </div>


     <div class="entryOverview">
       Returns a reference to the tree's root node.  Callers shouldn't modify nodes,
directly.  This is a convenience for visualization and debugging purposes.

     </div>


    <! -- Method details -->
    <div class="entryDetails">

   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<span class="type"><a href="class_goog_structs_QuadTree_Node.html">goog.structs.QuadTree.Node</a></span>&nbsp;
            The root node.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_structs_quadtree.js.source.html#line64">code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry public">
       <td class="access"></td>






  <td>
    <a name="goog.structs.QuadTree.prototype.getValues"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryName">getValues<span class="args">()</span>
        </span>
        &#8658; <span>!</span><span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Array">Array</a></span>.&lt;<span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Object">Object</a></span>&gt;
      </div>


     <div class="entryOverview">
       Returns an array containing all values stored within the tree.

     </div>


    <! -- Method details -->
    <div class="entryDetails">

   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<span>!</span><span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Array">Array</a></span>.&lt;<span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Object">Object</a></span>&gt;&nbsp;
            The values stored within the tree.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_structs_quadtree.js.source.html#line179">code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry private">
       <td class="access"></td>






  <td>
    <a name="goog.structs.QuadTree.prototype.insert_"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryName">insert_<span class="args">(<span class="arg">parent</span>,&nbsp;<span class="arg">point</span>)</span>
        </span>
        &#8658; <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Boolean">boolean</a></span>
      </div>


     <div class="entryOverview">
       Inserts a point into the tree, updating the tree's structure if necessary.

     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">parent</span>
        : <span class="type"><a href="class_goog_structs_QuadTree_Node.html">goog.structs.QuadTree.Node</a></span>
        <div class="entryOverview">The parent to insert the point
    into.</div>
     </td>
   </tr>
     
   <tr class="odd">
     <td>
        <span class="entryName">point</span>
        : <span class="type"><a href="class_goog_structs_QuadTree_Point.html">goog.structs.QuadTree.Point</a></span>
        <div class="entryOverview">The point to insert.</div>
     </td>
   </tr>
  </table>
      </div>
   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Boolean">boolean</a></span>&nbsp;
            True if a new node was added to the tree; False if a node
    already existed with the correpsonding coordinates and had its value
    reset.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_structs_quadtree.js.source.html#line289">code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry public">
       <td class="access"></td>






  <td>
    <a name="goog.structs.QuadTree.prototype.isEmpty"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryName">isEmpty<span class="args">()</span>
        </span>
        &#8658; <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Boolean">boolean</a></span>
      </div>


     <div class="entryOverview">
       <span class='nodesc'>No description.</span>
     </div>


    <! -- Method details -->
    <div class="entryDetails">

   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Boolean">boolean</a></span>&nbsp;
            Whether the tree is empty.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_structs_quadtree.js.source.html#line138">code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry public">
       <td class="access"></td>






  <td>
    <a name="goog.structs.QuadTree.prototype.remove"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryName">remove<span class="args">(<span class="arg">x</span>,&nbsp;<span class="arg">y</span>)</span>
        </span>
        &#8658; <span class="type">*</span>
      </div>


     <div class="entryOverview">
       Removes a point from (x, y) if it exists.

     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">x</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Number">number</a></span>
        <div class="entryOverview">The x-coordinate.</div>
     </td>
   </tr>
     
   <tr class="odd">
     <td>
        <span class="entryName">y</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Number">number</a></span>
        <div class="entryOverview">The y-coordinate.</div>
     </td>
   </tr>
  </table>
      </div>
   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<span class="type">*</span>&nbsp;
            The value of the node that was removed, or null if the
    node doesn't exist.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_structs_quadtree.js.source.html#line109">code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry public">
       <td class="access"></td>






  <td>
    <a name="goog.structs.QuadTree.prototype.set"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryName">set<span class="args">(<span class="arg">x</span>,&nbsp;<span class="arg">y</span>,&nbsp;<span class="arg">value</span>)</span>
        </span>
      </div>


     <div class="entryOverview">
       Sets the value of an (x, y) point within the quad-tree.

     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">x</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Number">number</a></span>
        <div class="entryOverview">The x-coordinate.</div>
     </td>
   </tr>
     
   <tr class="odd">
     <td>
        <span class="entryName">y</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Number">number</a></span>
        <div class="entryOverview">The y-coordinate.</div>
     </td>
   </tr>
     
   <tr class="even">
     <td>
        <span class="entryName">value</span>
        : <span class="type">*</span>
        <div class="entryOverview">The value associated with the point.</div>
     </td>
   </tr>
  </table>
      </div>
   
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_structs_quadtree.js.source.html#line75">code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry private">
       <td class="access"></td>






  <td>
    <a name="goog.structs.QuadTree.prototype.setPointForNode_"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryName">setPointForNode_<span class="args">(<span class="arg">node</span>,&nbsp;<span class="arg">point</span>)</span>
        </span>
      </div>


     <div class="entryOverview">
       Sets the point for a node, as long as the node is a leaf or empty.

     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">node</span>
        : <span class="type"><a href="class_goog_structs_QuadTree_Node.html">goog.structs.QuadTree.Node</a></span>
        <div class="entryOverview">The node to set the point for.</div>
     </td>
   </tr>
     
   <tr class="odd">
     <td>
        <span class="entryName">point</span>
        : <span class="type"><a href="class_goog_structs_QuadTree_Point.html">goog.structs.QuadTree.Point</a></span>
        <div class="entryOverview">The point to set.</div>
     </td>
   </tr>
  </table>
      </div>
   
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_structs_quadtree.js.source.html#line436">code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry private">
       <td class="access"></td>






  <td>
    <a name="goog.structs.QuadTree.prototype.split_"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryName">split_<span class="args">(<span class="arg">node</span>)</span>
        </span>
      </div>


     <div class="entryOverview">
       Converts a leaf node to a pointer node and reinserts the node's point into
the correct child.

     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">node</span>
        : <span class="type"><a href="class_goog_structs_QuadTree_Node.html">goog.structs.QuadTree.Node</a></span>
        <div class="entryOverview">The node to split.</div>
     </td>
   </tr>
  </table>
      </div>
   
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_structs_quadtree.js.source.html#line320">code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry private">
       <td class="access"></td>






  <td>
    <a name="goog.structs.QuadTree.prototype.traverse_"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryName">traverse_<span class="args">(<span class="arg">node</span>,&nbsp;<span class="arg">fn</span>)</span>
        </span>
      </div>


     <div class="entryOverview">
       Traverses the tree depth-first, with quadrants being traversed in clockwise
order (NE, SE, SW, NW).  The provided function will be called for each
leaf node that is encountered.

     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">node</span>
        : <span class="type"><a href="class_goog_structs_QuadTree_Node.html">goog.structs.QuadTree.Node</a></span>
        <div class="entryOverview">The current node.</div>
     </td>
   </tr>
     
   <tr class="odd">
     <td>
        <span class="entryName">fn</span>
        : <span class="type">function(goog.structs.QuadTree.Node</span>)
        <div class="entryOverview">The function to call
    for each leaf node. This function takes the node as an argument, and its
    return value is irrelevant.</div>
     </td>
   </tr>
  </table>
      </div>
   
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_structs_quadtree.js.source.html#line236">code &raquo;</a>
  </td>
     </tr>


  </table>
</div>
</div>




<h2>Instance Properties</h2>







<div>
       <div class="desc">
         Defined in
         <span class="fn-name">
            <a href="class_goog_structs_QuadTree.html">
              goog.structs.QuadTree
            </a>
         </span>
       </div>






<div class="section">
  <table class="horiz-rule">


     <tr class="even entry private">
       <td class="access"></td>





  <a name="goog.structs.QuadTree.prototype.count_"></a>

  <td>


     <div class="arg">
        <img align="left" src="static/images/blank.gif">

        <span class="entryName">count_</span>
        : 
     </div>


     <div class="entryOverview">
       Count of the number of items in the tree.

     </div>

  </td>


  <td class="view-code">
     <a href="local_closure_goog_structs_quadtree.js.source.html#line48">Code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry private">
       <td class="access"></td>





  <a name="goog.structs.QuadTree.prototype.root_"></a>

  <td>


     <div class="arg">
        <img align="left" src="static/images/blank.gif">

        <span class="entryName">root_</span>
        : <span class="type"><a href="class_goog_structs_QuadTree_Node.html">goog.structs.QuadTree.Node</a></span>
     </div>


     <div class="entryOverview">
       The root node for the quad tree.

     </div>

  </td>


  <td class="view-code">
     <a href="local_closure_goog_structs_quadtree.js.source.html#line54">Code &raquo;</a>
  </td>
     </tr>


  </table>
</div>
</div>










<div class="section">
  <table class="horiz-rule">


  </table>
</div>









<div class="section">
  <table class="horiz-rule">


  </table>
</div>



<h2>Enumerations</h2>






<div class="section">
  <table class="horiz-rule">


     <tr class="even entry public">
       <td class="access"></td>





  <a name="goog.structs.QuadTree.NodeType"></a>

  <td>


     <div class="arg">
        <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.structs.QuadTree.</span><span class="entryName">NodeType</span>
        : 
     </div>


     <div class="entryOverview">
       Enumeration of node types.

     </div>

     <div class="entryDetails">
       <div class="detailsSection">
          <b>Constants:</b>
          <table class="horiz-rule">
            <tbody>
              <tr><td>
                <span class="entryName">
                  EMPTY
                </span>
                <div class="entryOverview">
                  <span class='nodesc'>No description.</span>
                </div>
             </td></tr>
              <tr><td>
                <span class="entryName">
                  LEAF
                </span>
                <div class="entryOverview">
                  <span class='nodesc'>No description.</span>
                </div>
             </td></tr>
              <tr><td>
                <span class="entryName">
                  POINTER
                </span>
                <div class="entryOverview">
                  <span class='nodesc'>No description.</span>
                </div>
             </td></tr>
           </tbody>
         </table>
       </div>
     </div>

  </td>


  <td class="view-code">
     <a href="local_closure_goog_structs_quadtree.js.source.html#line449">Code &raquo;</a>
  </td>
     </tr>


  </table>
</div>
      <!-- Column 1 end -->
    </div>

        <div class="col2">
          <!-- Column 2 start -->
          <div class="col2-c">
            <h2 id="ref-head">Package structs</h2>
            <div id="localView"></div>
          </div>

          <div class="col2-c">
            <h2 id="ref-head">Package Reference</h2>
            <div id="sideTypeIndex" rootPath="" current="structs.QuadTree"></div>
          </div>
          <!-- Column 2 end -->
        </div>
</div>
</div>

</body>
</html>
